import type { AppRouteRecordRaw } from '@/router/types';
import { renderSvg } from '@/utils/index';

import { ErrorPage, RedirectName, Layout } from '@/router/constant';

// 404 on a page
export const ErrorPageRoute: AppRouteRecordRaw = {
  path: '/:path(.*)*',
  name: 'ErrorPage',
  component: Layout,
  meta: {
    title: 'errorPage',
    hideBreadcrumb: true,
  },
  children: [
    {
      path: '/:path(.*)*',
      name: 'ErrorPageSon',
      component: ErrorPage,
      meta: {
        title: 'errorPage',
        hideBreadcrumb: true,
      },
    },
  ],
};

export const RedirectRoute: AppRouteRecordRaw = {
  path: '/redirect',
  name: RedirectName,
  component: Layout,
  meta: {
    title: 'redirect',
    hideBreadcrumb: true,
  },
  children: [
    {
      path: '/redirect/:path(.*)',
      name: 'redirectPath',
      component: () => import('@/views/init/redirect/index.vue'),
      meta: {
        title: 'redirect',
        hideBreadcrumb: true,
      },
    },
  ],
};

export const DashboardRoute: AppRouteRecordRaw = {
  path: '/dashboard',
  name: 'Dashboard',
  redirect: '/dashboard/workplace',
  component: Layout,
  meta: {
    title: 'dashboard',
    icon: renderSvg('dashboard'),
    sort: 0,
  },
  children: [
    {
      path: 'workplace',
      name: `Home`,
      meta: {
        title: 'workplace',
        keepAlive: true,
      },
      component: () => import('@/views/init/dashboard/workplace/workplace.vue'),
    },
  ],
};

// export const SettingRoute: AppRouteRecordRaw = {
//   path: '/setting',
//   name: 'Setting',
//   redirect: '/setting/account',
//   component: Layout,
//   meta: {
//     title: 'setting',
//     icon: renderIcon(SettingOutlined),
//     sort: 5,
//     hidden: true,
//   },
//   children: [
//     {
//       path: 'account',
//       name: 'SettingAccount',
//       meta: {
//         title: 'settingAccount',
//       },
//       component: () => import('@/views/init/setting/account/account.vue'),
//     },
//     // {
//     //   path: 'system',
//     //   name: 'SettingSystem',
//     //   meta: {
//     //     title: '系统设置',
//     //   },
//     //   component: () => import('@/views/init/setting/system/system.vue'),
//     // },
//   ],
// };
